<template>

  <div class="app-container">
    <el-card shadow="never" class="mb20">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="系统日志" name="system">
          <SystemLogs ref="SystemLogs" />
        </el-tab-pane>
        <el-tab-pane label="登录日志" name="login">
          <LoginLogs ref="LoginLogs" />
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import SystemLogs from '@/views/system/systemLogs/components/SystemLogs'
import LoginLogs from '@/views/system/systemLogs/components/LoginLogs'

export default {
  components: {
    SystemLogs,
    LoginLogs
  },
  data() {
    return {
      activeName: 'system'
    }
  },
  filters: {},
  created() {
    this.$nextTick(() => {
      this.handleFilter()
    })
  },
  methods: {
    handleFilter() {
      if (this.activeName == 'system') {
        this.$refs.SystemLogs.fetchData()
      } else if (this.activeName == 'login') {
        this.$refs.LoginLogs.fetchData()
      }
    },
    handleClick(tab, event) {
      this.handleFilter()
    }
  }
}
</script>
